<?php
/**
 * Check if the user is registered (so has level 0 or higher)
 *
 * @param string $gebrnaam
 * @return boolean
 */
function IsRegistered($gebrnaam)
{
	$sql = "SELECT `level` FROM `user` WHERE `level` >= '0' AND `gebruikersnaam` = '" . $gebrnaam . "';";
	$levelr1 = mysql_query($sql);
	$levelr2 = mysql_fetch_assoc($levelr1);
	if($levelr2['level'] >= 0)
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Check if the user is moderator (so has level 1 or higher)
 *
 * @param string $gebrnaam
 * @return boolean
 */
function IsMod($gebrnaam)
{
	$sql = "SELECT `level` FROM `user` WHERE `level` >= '1' AND `gebruikersnaam` = '" . $gebrnaam . "';";
	$levelm1 = mysql_query($sql);
	$levelm2 = mysql_fetch_assoc($levelm1);
	if($levelm2['level'] >= 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Check if the user is administrator (so has level 2 or higher)
 *
 * @param string $gebrnaam
 * @return boolean
 */
function IsAdmin($gebrnaam)
{
	$sql = "SELECT `level` FROM `user` WHERE `level` >= '2' AND `gebruikersnaam` = '" . $gebrnaam . "';";
	$levela1 = mysql_query($sql);
	$levela2 = mysql_fetch_assoc($levela1);
	if($levela2['level'] >= 2)
	{
		return true;
	}
	else
	{
		return false;
	}
}